package com.sundablog.ocp;

import com.sundablog.ocp.service.IShop;
import com.sundablog.ocp.service.impl.RioShop;

import java.util.ArrayList;
import java.util.List;

public class Main {

    private final static List<IShop> shopList = new ArrayList<IShop>();
    //static静态模块初始化数据， 实际项目中一般是由持久层完成
    static {
        shopList.add(new RioShop("苹果鸡尾酒", 13.5, 500));
        shopList.add(new RioShop("葡萄鸡尾酒", 13.5, 200));
        shopList.add(new RioShop("红酒鸡尾酒", 13.5, 100));
        shopList.add(new RioShop("哈密瓜鸡尾酒", 13.5, 300));
    }
    //模拟商店卖出商品
    public static void main(String[] args) {
        for (IShop iShop : shopList) {
            System.out.println("商品名称" + iShop.getName());
            System.out.println("商品数量"+iShop.getNumber());
            System.out.println("商品价格"+iShop.getPrice());
        }

    }
}
